package com.ThreadAlive;

public class Main106 extends Thread{
    public static void main(String[] args){
        Main106 t1 = new Main106();
        t1.setName("thread1");
        t1.start();
        ThreadGroup currentGroup = Thread.currentThread().getThreadGroup();
        int noOfThreads = currentGroup.activeCount();
        Thread[] lstThreads = new Thread[noOfThreads];
        currentGroup.enumerate(lstThreads);
        for(int i=0;i<lstThreads.length;i++){
            System.out.println("线程组名："+currentGroup.getName()+"，线程名称："+lstThreads[i].getName());
        }
    }
}
